<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     
    <button class="btn">按钮一</button>
    <button class="btn">按钮二</button>
    <button class="btn">按钮三</button>
    <button class="btn">按钮四</button>
    
    <script>
         
         var btnEls = document.querySelectorAll(".btn");
         for (var i = 0;i<btnEls.length;i++)
         { 
             var btn = btnEls[i];
             (function(m)
             {  
                btn.onclick = function()
                {
                    console.log(`按钮${m}被点击`)
                }
             }(i)
             )
         }

         (
            function()
            {
                console.log()    
            }
         )

         var obj = {
            name:"小红",
            phone:"12345789",
            id:"444889",
            eating: function()
            {
                console.log("开始吃饭");
            }
        }
        
        console.log(obj.name)

        obj.eating();
        
    </script>
</body>
</html>